home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Softwarová Záchrana 3
/
Softwarova-zachrana-3.bin
/
Xteq X-Setup
/
xqdcXSP-Setup-EN.exe
/
{app}
/
plugins
/
XQ New File Menu.xpl
< prev
next >
Wrap
Text File
|
2001-01-31
|
8KB
|
327 lines
"FILE"="Xteq Systems X-Setup Plugin 5.0"
"TYPE"="9"
"COUNT"="1"
"UIPATH"="Appearance\Files&Folders\"New" Context Menu"
"NAME"="Show/Hide Items"
"VERSION"="1.10"
"LANGUAGE"="VBScript"
"TEXT 1"="---"
"DESCRIPTION 1"="This plug-in allows you to specify which items should appear in the NEW list in the Context Menu (right-click)."
"DESCRIPTION 2"="Items that have a checkmark will appear in the NEW list, items with no checkmark will not appear."
"AUTHOR"="Xteq Systems"
"CONTACTURL"="http://www.xteq.com"
"COPYRIGHT"="Copyright ⌐ Xteq Systems - All Rights Reserved"
"COMMENT 1"="Bloody complicated plug-in!!!"
sP="HKLM\Software\Classes\"
sV_ShellNew="\ShellNew"
sV_ShellNewDeac="\ShellNew-"
dim iItems 'contains the total amount of the registry keys
Dim aryItems() 'contains the name of the Registry paths (direct files starting with ".")
Dim aryItemsLoc() 'contains the registry location (\ShellNew or \ShellNew-)
Dim aryDesc() 'contains the description of the items
Sub Plugin_Initialize
if RegPathExists(sP) then
Call ReadRegistry
else
Call Disable
end if
End Sub
Sub ReadRegistry
iItems=RegEnumPaths(sP)
dim aryTemp
ReDim aryTemp(iItems)
dim aryTemp2
ReDim aryTemp2(iItems)
l=1
e=1
sDebug=""
'read all data from the path
For l=1 to iItems
sItem=RegEnumElement(l)
if left(sItem,1)="." then
s=IsShellNew(sP & sItem)
If len(s)>0 then
sDebug=sDebug & sItem
aryTemp(e)=sItem
aryTemp2(e)=s
e=e+1
end if
end if
next
'Call DebugMsg(sDebug)
sDebug=""
'now we have an array with the locations of the "ShellNew" or
'"ShellNew-" paths. However, to appear in the list, it must have
'have at least one entry in the list. If not, the "ShellNew(-)" entry
'is useless and will be set to "" to be sorted out later
for l=1 to e-1
s=aryTemp2(l)
iCount=RegEnumValues(s)
if iCount=0 then
sDebug=sDebug & aryTemp(l) & " - " & aryTemp2(l) & chr(13) & chr(10)
aryTemp(l)=""
aryTemp2(l)=""
end if
next
'Call DebugMsg(sDebug)
'okay, now count how many items we have left (that are not empty)...
iItems=0
for l=1 to e-1
If Len(aryTemp(l))>0 then
iItems=iItems+1
end if
next
'redim final arrays with this value
ReDim aryItems(iItems)
ReDim aryItemsLoc(iItems)
ReDim aryDesc(iItems)
'copy from temp array to the final ones
i=1
for l=1 to e-1
If Len(aryTemp(l))>0 then
aryItems(i)=aryTemp(l)
aryItemsLoc(i)=aryTemp2(l)
i=i+1
end if
next
'fill third array with the file description
for l=1 to iItems
aryDesc(l)=GetFileDescription(aryItems(l))
next
'AND NOW update the UI
for l=1 to iItems
Call SetUIElement(l,aryDesc(l) & " (" & aryItems(l) & ")") 'set data in X-Setup
if Right(aryItemsLoc(l),1)<>"-" then 'not disabled
Call SetUIElementEx(l,true) 'set activated
else
Call SetUIElementEx(l,false) 'set not active
end if
Next
End Sub
'VERSION 1.1
'returns the readable description for a file TYPE. Input is the
'raw file type (e.g. ".TXT").
Function GetFileDescription(DotType)
sxd_BasePath="HKLM\Software\Classes\"
sxd_Path=sxd_BasePath & DotType & "\@"
sxd_Val=RegReadValue(sxd_Path)
if IsEmpty(sxd_Val)=true then
'extended description not found! return default
GetFileDescription="<UNKNOWN>"
else
'found, now get the "real" description
sxd_Path=sxd_BasePath & sxd_Val & "\@"
sxd_Name=RegReadValue(sxd_Path)
if IsEmpty(sxd_Name)=true then
'argh!
GetFileDescription="<UNKNOWN>"
else
GetFileDescription=sxd_Name
end if
end if
End Function
'VERSION 1.2
'returns the reg path to the ShellNew(-) path or "" if nothing was found. Input is the
'path to the data type (e.g. "HKCR\.TXT").
Function IsShellNew(Path)
Dim sCheck,sReturn
xd_sV_ShellNew="\ShellNew"
xd_sV_ShellNewDeac="\ShellNew-"
sReturn=""
'maybe it's a little trick file
s=RegReadValue(Path & "\@")
if IsEmpty(s)=false then
'HKCR\.XXX\XX File\ShellNew
sCheck=Path & "\" & s & xd_sV_ShellNew
if RegPathExists(sCheck) then
sReturn=sCheck
else
'maybe deactivated?
sCheck=Path & "\" & s & xd_sV_ShellNewDeac
if RegPathExists(sCheck) then
sReturn=sCheck
else
'okay, I give up! I have checked all possibilies...
sReturn=""
end if
end if
end if
if sReturn="" then
'Maybe this value has no name, so check on the .XXX file directly
'HKCR\.XXX\ShellNew
sCheck=Path & xd_sV_ShellNew
If RegPathExists(sCheck) then
sReturn=sCheck
else
'now check if it's deactivated...
'HKCR\.XXX\ShellNew
sCheck=Path & xd_sV_ShellNewDeac
If RegPathExists(sCheck) then
sReturn=sCheck
else
'I give up..
sReturn=""
end if
end if
end if
IsShellNew=sReturn
End Function
Sub Plugin_Apply(ElementIndex,ElementSubIndex)
bChanges=false
for l=1 to iItems
'for debugging....
s=s & GetUIElement(l) & "-" & GetUIElementEx(l) & "-" & aryItemsLoc(l) & chr(13) & chr(10)
bUI=GetUIElementEx(l)
sCurPath=aryItemsLoc(l)
if Right(sCurPath,1)="-" then
bReg=false
else
bReg=true
end if
if bUI=true and bReg=true then
'do nothing, both activated
else
if bUI=false and bReg=false then
'do nothing, both deactivated
else
if bUI=true and bReg=false then
sNewPath=left(sCurPath,len(sCurPath)-1) 'from "ShellNew-" to "ShellNew"
else
sNewPath=sCurPath & "-" 'from "ShellNew" to "ShellNew-"
end if
'execute move action
Call MoveFolder(sCurPath,sNewPath)
'set flag
bChanges=true
end if
end if
next
if bChanges=true then
'clear UI
for i=1 to iItems
Call SetUIElement(i,"")
next
're-read UI
Call ReadRegistry
'call the holy Windows API
Call IndicateSettingChange()
'just to be sure...
Call Logoff
end if
End Sub
Sub MoveFolder(CurrentFolder,NewFolder)
if right(CurrentFolder,1)<>"\" then
CurrentFolder=CurrentFolder & "\"
end if
if right(NewFolder,1)<>"\" then
NewFolder=NewFolder & "\"
end if
'move values for base path
Call MoveValues(CurrentFolder,NewFolder)
'check for any existing subfolder
iC=RegEnumPaths(CurrentFolder)
if iC>0 then
Dim aryTemp()
ReDim aryTemp(iC)
for i=1 to iC
aryTemp(i)=RegEnumElement(i) & "\"
next
for i=1 to iC
sP_Old=CurrentFolder & aryTemp(i)
sP_New=NewFolder & aryTemp(i)
Call MoveValues(sP_Old,sP_New)
Call RegDeletePath(sP_Old)
next
end if
'remove old path
Call RegDeletePath(CurrentFolder)
End Sub
Sub MoveValues(OldFolder,NewFolder)
iC=RegEnumValues(OldFolder)
for i=1 to iC
x_Name=RegEnumElement(i)
x_Type=RegValueType(OldFolder & x_Name)
x_Value=RegReadValue(OldFolder & x_Name)
'move to new location
Call RegWriteValue(NewFolder & x_Name,x_Value,x_Type)
'delete old value
Call RegDeleteValue(OldFolder & x_Name)
next
End Sub
Sub Plugin_Terminate
End Sub